<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Userpanel extends CI_Controller {

	function __construct() {
		parent::__construct();
		$this->load->library('ion_auth');
		$this->load->library('form_validation');
		$this->load->helper('url');

		$this->load->database();

		$this->form_validation->set_error_delimiters($this->config->item('error_start_delimiter', 'ion_auth'), $this->config->item('error_end_delimiter', 'ion_auth'));

		$this->lang->load('auth');
		$this->load->helper('language');
	}

	public function my_profile() {
		if (!$this->ion_auth->logged_in()) {
			redirect('login', 'refresh');
		}
		$user = $this->ion_auth->user()->row();
		$this->data['user_id'] = $user->id;
		$this->data['username'] = $user->username;
		$this->data['email'] = $user->email;
		$this->data['remember_code'] = $user->remember_code;
		$this->data['created_on'] = $user->created_on;
		$this->data['last_login'] = $user->last_login;
		$this->data['first_name'] = $user->first_name;
		$this->data['last_name'] = $user->last_name;
		$this->data['company'] = $user->company;
		$this->data['phone'] = $user->phone;
		
		$this->data['title'] = "My Profile";
		$this->data['subtitle'] = "Here all are your personal information. Use <strong>{$this->data['title']}</strong> sidebar to edit your information and your activities over the site.";
		
		$this->load->view('layout/header', $this->data);
		$this->load->view('profile', $this->data);
		$this->load->view('layout/footer');
	}
}
?>